package cn.bigway.app.weavingdesigner.operator;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.util.HashMap;

import javax.swing.event.MouseInputListener;

import cn.bigway.app.weavingdesigner.type.WdMenuItemType;

public class WdDocOperationManager implements KeyListener, MouseWheelListener,
		MouseInputListener {

	public static final WdMenuItemType DEFAULT_OPERATOR = WdMenuItemType.EMIT_OPERATOR_NORMAL;

	private WdMenuItemType type;
	private WdDocOperator currentOperator;
	private final HashMap<WdMenuItemType, WdDocOperator> operators = new HashMap<WdMenuItemType, WdDocOperator>();

	public WdDocOperationManager() {
		this.type = DEFAULT_OPERATOR;
		this.currentOperator = new WdDocNormalOperator();
		this.operators.put(this.type, this.currentOperator);
	}

	@Override
	public void mouseDragged(MouseEvent event) {
		this.currentOperator.mouseDragged(event);
	}

	@Override
	public void mouseMoved(MouseEvent event) {
		this.currentOperator.mouseMoved(event);
	}

	@Override
	public void mouseClicked(MouseEvent event) {
		this.currentOperator.mouseClicked(event);
	}

	@Override
	public void mouseEntered(MouseEvent event) {
		this.currentOperator.mouseEntered(event);
	}

	@Override
	public void mouseExited(MouseEvent event) {
		this.currentOperator.mouseExited(event);
	}

	@Override
	public void mousePressed(MouseEvent event) {
		this.currentOperator.mousePressed(event);
	}

	@Override
	public void mouseReleased(MouseEvent event) {
		this.currentOperator.mouseReleased(event);
	}

	@Override
	public void mouseWheelMoved(MouseWheelEvent event) {
		this.currentOperator.mouseWheelMoved(event);
	}

	@Override
	public void keyPressed(KeyEvent event) {
		this.currentOperator.keyPressed(event);
	}

	@Override
	public void keyReleased(KeyEvent event) {
		this.currentOperator.keyReleased(event);
	}

	@Override
	public void keyTyped(KeyEvent event) {
		this.currentOperator.keyTyped(event);
	}
}
